package com.singzi.javaSenior.annotationTest;

import java.lang.reflect.Method;

public class Main {
    public static void main(String[] args) throws Exception {

        String clazz = "com.singzi.javaSenior.annotationTest.Foo";
        Class<?> foo = Class.forName(clazz);
        Foo foo1 = (Foo) foo.newInstance();

        for(Method m: foo.getMethods()){
//            System.out.println(m.getName());
            if(m.isAnnotationPresent(MyAnnotation.class)){
                MyAnnotation test1 = m.getAnnotation(MyAnnotation.class);
                m.invoke(foo1, test1.a(), test1.b());
            }
        }
    }
}
